﻿using Smobiler.Core;
using Smobiler.Core.Controls;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DAL;
using FubiManger.UI;

namespace FubiManger.Controls
{
    ////ToolboxItem用于控制是否添加自定义控件到工具箱，true添加，false不添加
    //[System.ComponentModel.ToolboxItem(true)]
    partial class staffcontrol : Smobiler.Core.Controls.MobileUserControl
    {
        public staffcontrol() : base()
        {
            //This call is required by the SmobilerUserControl.
            InitializeComponent();
        }

        private void btnstatus_Press(object sender, EventArgs e)
        {
            if (btnstatus.Text == "停用")
            {
                MessageBox.Show("是否启用该账号", "提示", MessageBoxButtons.OKCancel, (obj, args) =>
                {
                    if (args.Result == ShowResult.OK)
                    {
                        if (adminsDal.Deladmin(lblname.Text) > 0)
                        {
                            ((StaffsForm)this.Form).Resfh();//刷新
                        }
                    }
                });
            }            
        }

        private void staffcontrol_Load(object sender, EventArgs e)
        {
            switch (lbltype.Text)
            {
                case "1":
                    lbltype.Text = "岗位：管理员";
                    break;
                case "2":
                    lbltype.Text = "岗位：前台收银";
                    break;
                case "3":
                    lbltype.Text = "岗位：工作人员";
                    break;
                case "4":
                    lbltype.Text = "岗位：后勤物流";
                    break;
                case "5":
                    lbltype.Text = "岗位：后厨";
                    break;
                case "6":
                    lbltype.Text = "岗位：副屏";
                    break;
            }
            switch (lblstatus.Text)
            {
                case "1":
                    btnstatus.Text = "停用";
                    break;
              
            }
        }
    }
}